package com.MedDroid.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import com.MedDroid.MainApp;
import com.MedDroid.R;
import com.MedDroid.task.AddNewDataRecordTask;

public class AddRecordActivity extends Activity
{
	public EditText EditWeight;
	public DatePicker RecordDate;
	public int LoadedUser;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_record);

		Bundle extras = getIntent().getExtras();
		if (extras != null)
		{
			LoadedUser = extras.getInt("UserID");
		}

		Button btnAddRecord = (Button) findViewById(R.id.btnCreateRecord);
		EditWeight = (EditText) findViewById(R.id.txtWeight);
		RecordDate = (DatePicker) findViewById(R.id.datePicker);

		btnAddRecord.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View view)
			{
				new AddNewDataRecordTask(((MainApp)getApplication()).getDatabase(), AddRecordActivity.this).execute(LoadedUser);
			}
		});
    }
}